using System;

namespace muduoDotNet.Common
{
    /// <summary>
    /// 全局常量定义
    /// </summary>
    public static class Constants
    {
        /// <summary>
        /// 网络相关常量
        /// </summary>
        public static class Network
        {
            /// <summary>
            /// 默认缓冲区大小
            /// </summary>
            public const int DefaultBufferSize = 64 * 1024; // 64KB

            /// <summary>
            /// 最大连接数
            /// </summary>
            public const int MaxConnections = 65536;

            /// <summary>
            /// 默认超时时间（毫秒）
            /// </summary>
            public const int DefaultTimeoutMs = 30000; // 30秒

            /// <summary>
            /// 心跳间隔（毫秒）
            /// </summary>
            public const int HeartbeatIntervalMs = 30000; // 30秒
        }

        /// <summary>
        /// 协议相关常量
        /// </summary>
        public static class Protocol
        {
            /// <summary>
            /// Protobuf消息头长度
            /// </summary>
            public const int ProtobufHeaderLength = 4;

            /// <summary>
            /// 最大消息长度
            /// </summary>
            public const int MaxMessageLength = 64 * 1024 * 1024; // 64MB

            /// <summary>
            /// 协议版本
            /// </summary>
            public const string Version = "1.0";
        }

        /// <summary>
        /// 日志相关常量
        /// </summary>
        public static class Logging
        {
            /// <summary>
            /// 默认日志格式
            /// </summary>
            public const string DefaultFormat = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] {SourceContext}: {Message}{NewLine}{Exception}";
        }
    }
}